import * as THREE from "three"
import ObservableObject from "../observer/observable.object"
import { ExtGIF, extText } from "../../rule3d"
import funcUtil from "../utils/func.util"
export interface extCustom {
  detail_audio: extAudio
  version: number
  normal: THREE.Vector3
  detail_article: any
  detail_album: string[]
  detail_album_eye: boolean
  tag: extTag
  btnColor: string
}
export interface extAudio {
  musicFile: string
  name: string
}
export interface extTag {
  enable: boolean
  length: number
  visible: boolean
  texture: string
  showTitle: boolean
}
interface extData {
  contentType: number
  info: extInfo
  placeholder: string
  texture: string
}
interface extInfo {
  backLucency: boolean
  btnText: string
  custom: extCustom
  discripe: string
  hot: string
  music: string
  sweep: string
  swiperList: string[]
  target: number
  type: number
  url: string
  urlName: string
}
export default class ExtObj extends ObservableObject {
  id: string
  contentType: number
  discripe: string
  enable: boolean
  extdata: extData
  followCamera: boolean
  gif: ExtGIF
  info: any
  location: string
  mtl: string
  music: string
  name: string
  obj: string
  occupiedFodder: boolean
  opacity: number
  packTexture: number
  picturesId: string
  position: THREE.Vector3
  positionId: string
  quaternion: THREE.Quaternion
  quaternionId: string
  scale: THREE.Vector3
  scaleId: string
  scaling: string
  text: extText
  texture: string
  type: number
  x0: number
  x1: number
  y0: number
  y1: number
  constructor() {
    super()
  }
  isAligned() {}
  isUnplaced() {}
  get sid() {
    return this.id
  }
  equals(e: ExtObj) {
    return this.id === e.id && this.name === e.name
  }
  copy(e: ExtObj) {
    this.id = funcUtil.randomStr(11)
    this.contentType = e.contentType
    this.discripe = e.discripe
    this.enable = e.enable
    this.followCamera = e.followCamera
    this.location = e.location
    this.mtl = e.mtl
    this.music = e.music
    this.name = e.name
    this.obj = e.obj
    this.occupiedFodder = e.occupiedFodder
    this.opacity = e.opacity
    this.packTexture = e.packTexture
    this.picturesId = e.picturesId
    this.position = e.position.clone()
    this.positionId = e.positionId
    this.quaternion = e.quaternion.clone()
    this.quaternionId = e.quaternionId
    this.scale = e.scale.clone()
    this.scaleId = e.scaleId
    this.scaling = e.scaling
    this.texture = e.texture
    this.type = e.type
    this.x0 = e.x0
    this.x1 = e.x1
    this.y0 = e.y0
    this.y1 = e.y1
    return this
  }
  refresh(e: ExtObj) {}
}
